package com.cmyshare.design.compositePattern;

import java.util.List;

/**
 * @Author cmy
 * @Date 2025/7/5 17:23
 * @version 1.0
 * @desc 定义Component类Employer
 */
public abstract class Employer {
    /**
     * 员工名称
     */
    private String name;

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return this.name;
    }

    /**
     * 添加下属
     * @param employer
     */
    public abstract void add(Employer employer);

    /**
     * 删除下属
     * @param employer
     */
    public abstract void delete(Employer employer);

    /**
     * 下属列表
     */
    public List<Employer> employers;

    public void printInfo() {
        System.out.println(name);
    }

    /**
     * 获取下属
     * @return
     */
    public List<Employer> getEmployers() {
        return this.employers;
    }

}
